﻿@model IEnumerable<IGrouping<char, Manufacturer>>
    <script type="text/javascript">
        $(function () {
            $("#quickSearchManufacturerSelector").change(function () {
                if (this.value > 0) {
                    $(".SeriesSelector").hide();
                    $("#quickSearchSeriesSelector_" + this.value).show();
                }
            });
        });

        function OpenSeries() {
            var s = $("#quickSearchSeriesSelector_" + $("#quickSearchManufacturerSelector").val()).val();
            if (s > 0) {
                window.open("@Url.Action("Series", "Car", new { id = -12345678 })".replace("-12345678", s));
            }
        }
    </script>
<div id="searchAndSelector">
    <div>车型查询:</div>
    <div>
        <input type="text" /><input type="button" value="搜索" />
    </div>
    <div>
        <select id="quickSearchManufacturerSelector">
            <option>选品牌</option>
        @foreach (var g in Model)
        {
            <optgroup label="@g.Key">
                @foreach (var m in g)
                {
                    <option value="@m.ID">@m.Name</option>
                }
            </optgroup>
        }
        </select>
        <select class="SeriesSelector">
            <option>选车系</option>
        </select>
            @foreach (var g in Model)
            {
                foreach (var m in g)
                {
        <select class="SeriesSelector" id="quickSearchSeriesSelector_@(m.ID)">
            <option>选车系</option>
                    @foreach (var b in m.Brands)
                    {
                        foreach (var s in b.Series)
                        {
            <option title="@m.ID" value="@s.ID">@s.Name</option>
                        }
                    }
        </select>
                }
            }
        <input type="button" value="搜索" onclick="OpenSeries()" />
</div>
</div>
<div id="classesSelector">
    <ul>
        <li class="a">@Html.ActionLink("微型", "Class", "Car", new { id = 1 }, null)</li>
        <li class="b">@Html.ActionLink("小型", "Class", "Car", new { id = 2 }, null)</li>
        <li class="c">@Html.ActionLink("紧凑型", "Class", "Car", new { id = 3 }, null)</li>
        <li class="d">@Html.ActionLink("中型", "Class", "Car", new { id = 4 }, null)</li>
        <li class="e">@Html.ActionLink("中大型", "Class", "Car", new { id = 5 }, null)</li>
        <li class="f">@Html.ActionLink("豪华型", "Class", "Car", new { id = 6 }, null)</li>
        <li class="g">@Html.ActionLink("MPV", "Class", "Car", new { id = 7 }, null)</li>
        <li class="h">@Html.ActionLink("SUV", "Class", "Car", new { id = 8 }, null)</li>
        <li class="i">@Html.ActionLink("跑车", "Class", "Car", new { id = 9 }, null)</li>
    </ul>
</div>